﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace EentitfFrameworkMvc.Models
{
    public partial class Data01Context : DbContext
    {
        public virtual DbSet<Images> Images { get; set; }
        public virtual DbSet<TbStu> TbStu { get; set; }
        public virtual DbSet<TbStudent> TbStudent { get; set; }

        public Data01Context(DbContextOptions<Data01Context> options) : base(options)
        {
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Images>(entity =>
            {
                entity.HasKey(e => e.ImageId)
                    .HasName("PK__Images__7516F4EC312D5D23");

                entity.Property(e => e.ImageId).ValueGeneratedNever();
            });

            modelBuilder.Entity<TbStu>(entity =>
            {
                entity.HasKey(e => e.StuId)
                    .HasName("PK__tb_stu__E53CAB216106D40A");

                entity.Property(e => e.StuEmail).IsUnicode(false);

                entity.Property(e => e.StuHome).IsUnicode(false);

                entity.Property(e => e.StuIdentity).IsUnicode(false);

                entity.Property(e => e.StuName).IsUnicode(false);

                entity.Property(e => e.StuSpwd)
                    .IsUnicode(false)
                    .HasDefaultValueSql("('123456')");

                entity.Property(e => e.StuStatus).HasDefaultValueSql("((0))");
            });

            modelBuilder.Entity<TbStudent>(entity =>
            {
                entity.HasKey(e => e.Sid)
                    .HasName("PK__tb_stude__DDDFDD36CB1006D0");

                entity.Property(e => e.Sname).IsUnicode(false);

                entity.Property(e => e.Spwd)
                    .IsUnicode(false)
                    .HasDefaultValueSql("('123456')");

                entity.Property(e => e.Ssex).IsUnicode(false);

                entity.Property(e => e.Ssf).IsUnicode(false);
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
